﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Core
{
    public static partial class contest
    {
        public static dynamic showStatus(int cid,int start, int limit)
        {
            var sql = new Sql.SqlDataContext();
            var result = (from c in sql.ContestStatus
                          where c.cid == cid
                          orderby c.submitTime
                          select new
                          {
                              rid = c.rid,
                              ps = c.ps,
                              username = c.username,
                              status = status.status2String(c.status),
                              submitTime = c.submitTime.toDateString(),
                              memory = c.exeMem,
                              time = c.exeTime
                          }).Skip(start).Take(limit);
            int total = result.Count();
            return new{
                result,
                total,
                success = true
            };
        }
    }
}
